<template>
  <div class='demo'>
    <h2>学生名称：{{name}}</h2>
    <h2>学生年龄：{{age}}</h2>
    <h2>学生性别：{{sex}}</h2>
    <button @click="showName">点我显示学生姓名</button>
  </div>
</template>

<script>
 
export default {
     name:"School",
     data() {
        return {
            name:'小莫',
            age:22,
            sex:"男"
        }
     }, methods: {
        showName(){
            alert(this.name)
        }
     },
      
     
}
</script>

<style scoped>
    .demo{
        background-color:aqua;
    }
</style>